<!-- 
 * 微课堂首页
 * ============================================================================
 * 版权所有 2015-2017 风影随行，并保留所有权利。
 * 网站地址: http://www.haoshu888.com
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！不允许对程序代码以任何形式任何目的的再发布，作者将保留
 * 追究法律责任的权力和最终解释权。
-->
{template '_headerv2'}
<style>
.weui_tab_bd{height: auto; padding-bottom: 0;}
</style>
<script src="{MODULE_URL}template/mobile/style/jsv2/BreakingNews.js?v={$versions}"></script>
<link rel="stylesheet" href="{MODULE_URL}template/mobile/style/cssv2/mb3_blue.css?v={$versions}"/>
<link rel="stylesheet" href="{MODULE_URL}template/mobile/style/cssv2/foundation.min.css?v={$versions}"/>

<link rel="stylesheet" href="{MODULE_URL}template/mobile/style/cssv2/iconfont.css?v={$versions}"/>
<link rel="stylesheet" href="{MODULE_URL}template/mobile/style/cssv2/appadmin.css?v={$versions}"/>
 <script type="text/javascript" src="{MODULE_URL}template/mobile/style/jsv2/jquery.lazyload.min.js?t=3" ></script>
    <script type="text/javascript" charset="utf-8">
        $(function() {
            $("img.lazy").lazyload({
                effect: "fadeIn"
            });
        });
    </script>
<script type="text/javascript">
$(function() {
	$('#breakingnews').BreakingNews({
		title: '<img src="{MODULE_URL}template/mobile/images/ico-inform.png" style="width:32px;margin-top:4px;">',
		titlebgcolor: '#ffffff',
		linkhovercolor: '#099',
		border: '1px solid #f3f3f3',
		timer: 5000,
		effect: 'slide'
	});
});
</script>

{if $setting['isfollow']>0 && $fans['follow']==0 && $userAgent}
<!--<div class="follow_topbar">
	<div class="headimg">
		<img src="{$_W['attachurl']}{$setting['qrcode']}">
	</div>
	<div class="info">
		<div class="i">{$_W['account']['name']}</div>
		<div class="i">{$setting['follow_word']}</div>
	</div>
	<div class="sub" onclick="location.href='{php echo $this->createMobileUrl('follow');}'">立即关注</div>
</div>
<div style='height:44px;'>&nbsp;</div>-->
{/if}

<div class="weui_tab_bd" id="weui_tab_div">
	<!-- 搜索框 -->
	<!--<div class="index-header-search">
		<div class="u-search">
			<i class="fa fa-search"></i>
			<input type="text" id="searchInput" class="search_input z-abled" value="" autocorrect="off" placeholder="输入课程名称进行查找">
		</div>
	</div>-->
	<!-- /搜索框 -->

	<!-- 广告轮播图 -->
	{if !empty($setting['banner'])}
	<div class="swiper-container">
		<div class="swiper-wrapper">
			<!--图片一-->
			{loop $banner $item} {if !empty($item['img'])}
			<div class="swiper-slide">
				<a href="{$item['link']}">
					<img class="swiper-lazy" data-src="{$_W['attachurl']}{$item['img']}">
				</a>
			</div>
			{/if} {/loop}
			<!--图片一end-->
		</div>
		<div class="swiper-pagination"></div>
	</div>
	{/if}
	<!-- /广告轮播图 -->

	<!-- 分类 -->
	
	
	    <section>
        <div class="row">
                            <a class="small-3 columns vg-block vg-padding-horizontal-xs   text-center  vg-mb3-nav-wrap vg-login-bg vg-bdb-default"
                   href="{php echo $this->createMobileUrl('self');}">
                    <div class="vg-hfull">
                        <div class="vg-circle vg-bg-white text-center vg-text-sm vg-main-font-color vg-mb3-nav-wrap-login vg-margin-top-sm vg-padding-top-xs vg-lh-16 " style="font-size: 12px;">
                            {$member['nickname']}<br>{if empty($memberVip)}普通等级{else}$memberVip['level_id']{/if}
                        </div>
                    </div>
                </a>
            
            <a class="small-3 columns vg-block vg-padding-horizontal-0  vg-padding-vertical-sm  text-center vg-bdb-default vg-bdr-default  vg-mb3-nav-wrap vg-text-gray"
               href="#">
                <i class="icon iconfont vg-text-gray vg-text-icon3">&#xe609;</i>
                <div class="vg-text-sm vg-text-black">我的积分</div>
            </a>

            <a class="small-3 columns vg-block vg-padding-horizontal-0 vg-padding-vertical-sm  text-center vg-mb3-nav-wrap vg-bdb-default vg-bdr-default"
               href="{php echo $this->createMobileUrl('team', array('level'=>1));}">
                <i class="icon iconfont vg-text-gray vg-text-icon3">&#xe608;</i>
                <div class="vg-text-sm vg-text-black">我的同学</div>
            </a>
            <a class="small-3 columns vg-block vg-padding-horizontal-0 vg-padding-vertical-sm  text-center vg-mb3-nav-wrap vg-bdb-default"
               href="{php echo $this->createMobileUrl('commission');}">
                <i class="icon iconfont vg-text-gray vg-text-icon3">&#xe693;</i>
                <div class="vg-text-sm vg-text-black">奖学金</div>
            </a>
        </div>
        <div class="row">
                            <a class="small-3 columns vg-block vg-padding-horizontal-0   text-center  vg-mb3-nav-wrap vg-login-bg"
                   href="{php echo $this->createMobileUrl('vip');}">
                    <div class="vg-circle vg-bg-white text-center vg-text-sm vg-main-font-color vg-mb3-nav-wrap-login vg-margin-top-sm vg-padding-top-xs vg-lh-16">
                        升级<br>VIP
                    </div>
                </a>
                        <a class="small-3 columns vg-block vg-padding-horizontal-0  vg-padding-vertical-sm  text-center  vg-mb3-nav-wrap vg-text-gray vg-bdr-default"
               href="{php echo $this->createMobileUrl('commission');}">
                <i class="icon iconfont vg-text-gray vg-text-icon3">&#xe694;</i>
                <div class="vg-text-sm vg-text-black">代理商</div>
            </a>
            <a id="gzhShow"
               class="small-3 columns vg-block vg-padding-horizontal-0 vg-padding-vertical-sm  text-center vg-mb3-nav-wrap vg-bdr-default"
               href="javascript:;">
                <i class="icon iconfont vg-text-gray vg-text-icon3">&#xe60b;</i>
                <div class="vg-text-sm vg-text-black">关注公众号</div>
            </a>
            <div class="body-shadow" id="guanzhugongzhao">
                <div class="weixin-code-box">
                    <div class="weixin-code-wrap vg-padding-lg">
                        <img width="100%" src="{$_W['attachurl']}{$setting['qrcode']}"
                             alt="">
                        <span class="shadow-close"> <i class="icon iconfont vg-text-xl vg-text-gray">&#xe61c;</i></span>
                    </div>
                </div>
            </div>
            <a id="bzrShow"
               class="small-3 columns vg-block vg-padding-horizontal-0 vg-padding-vertical-sm  text-center vg-mb3-nav-wrap"
               href="javascript:;">
                <i class="icon iconfont vg-text-gray vg-text-icon3">&#xe60a;</i>
                <div class="vg-text-sm vg-text-black">添加班主任</div>
            </a>
            <div class="body-shadow">
                <div class="weixin-code-box">
                    <div class="weixin-code-wrap vg-padding-lg">
                        <img width="100%" src="{$_W['attachurl']}{$setting['qrcode']}"
                             alt="">
                        <span class="shadow-close"> <i class="icon iconfont vg-text-xl vg-text-gray">&#xe61c;</i></span>
                    </div>
                </div>
            </div>
        </div>
    </section>
	{if !empty($category_list)}
	
	<!--<div class="grid_wrap bor_no">
		{loop $category_list $item}
		<a class="grid_item uc-flex1" href="{php echo $this->createMobileUrl('search', array('cat_id'=>$item['id']));}">
			<div class="grid_hd">
				<img src="{$_W['attachurl']}{$item['ico']}" alt="{$item['name']}" />
			</div>
			<div class="grid_bd">
				<p>{$item['name']}</p>
			</div>
		</a>
		{/loop}
		{if !empty($allCategoryIco)}
		<a class="grid_item uc-flex1" href="{php echo $this->createMobileUrl('search',array('op'=>'allcategory'));}">
			<div class="grid_hd">
				<img src="{$allCategoryIco}" alt="全部分类">
			</div>
			<div class="grid_bd">
				<p>全部分类</p>
			</div>
		</a>
		{/if}
	</div>-->
	
	    <section>
        <div class="vg-bg-default vg-padding-top-xs">
            <div class="vg-bg-white vg-padding-horizontal-sm vg-padding-top vg-padding-bottom-sm">
                <div class="vg-text-default vg-tit-bdl-2 vg-padding-left-xs vg-lh-1">
                    <span class="vg-text-bold">课程分类</span>
                                            <a class="vg-text-gray vg-text-sm vg-fr" href="{php echo $this->createMobileUrl('search',array('op'=>'allcategory'));}">更多分类></a>
                                    </div>
            </div>
        </div>
        <div class="vg-padding-horizontal-sm">
            <ul class="vg-avg-sm-2 vg-thumbnails">
			{loop $category_list $item}
                     <li class="">
                        <a href="{php echo $this->createMobileUrl('search', array('cat_id'=>$item['id']));}">
                            <div class="vg-parent-box">
                                <img class="vg-radius am-thumbnail lazy" width="100%" data-original="{$_W['attachurl']}{$item['ico']}" alt="{$item['name']}">
                            </div>
                        </a>
                    </li>
             {/loop}    
                            </ul>
        </div>
    </section>
	
	{/if}
	<!-- /分类 -->
	
	<!-- 公告 -->
	{if !empty($articlelist) && is_array($articlelist)}
	<div class="BreakingNewsController easing" id="breakingnews">
		<div class="bn-title" onclick="location.href='{php echo $this->createMobileUrl('article', array('op'=>'list'));}'"></div>
		<ul>
			{loop $articlelist $article}
			<li><a href="{php echo $this->createMobileUrl('article', array('op'=>'display','aid'=>$article['id']));}">[{php echo date('m-d',$article['addtime']);}]{$article['title']}</a></li>
			{/loop}
		</ul>
		<div class="bn-arrows" onclick="location.href='{php echo $this->createMobileUrl('article', array('op'=>'list'));}'">更多</div>	
	</div>
	{/if}
	<!-- /公告 -->
	
	 <section>
                        </section>   


						
		<!-- 最新课程 -->
	{if $setting['show_newlesson'] && $newlesson}				
       
	<div class="course_wrap mt10">
		<h2 class="course_hd"><span class="bor-l"></span>最新更新</h2>
		<ul class="newlesson-list" style="min-height:1px;">
			{loop $newlesson $item}
			<li class="lesson_list">
				<a href="{php echo $this->createMobileUrl('lesson', array('op'=>'display', 'id'=>$item['id']));}" class="package">
					<div class="package__cover-wrap">
						<div class="package__cover" style="background-image: url({$_W['attachurl']}{$item['images']});">
							<span class="package__cover-tips package__cover-tips--status">{if $item['price']>0}{php echo $item['buynum']+$item['virtual_buynum'];}{else}{php echo $item['buynum']+$item['virtual_buynum']+$item['visit_number'];}{/if}人已学习</span>
						</div>
					</div>
					<div class="package__content">
						<h3 class="package__name">{$item['bookname']}</h3>
						<div class="package__info">
							<span class="pink-color subhead">{$item['section']['title']}</span>
						</div>
						<div class="package__info">
							<span class="grey-color">{$item['tran_time']}更新</span>
							<div class="package__course-num"><i class="red-color">{php echo $item['price']>0?'¥'.$item['price']:'免费';}</i></div>
						</div>
					</div>
				</a>
			</li>
			{/loop}
		</ul>
		
	</div>
	{/if}
	<!-- /最新课程 -->

	<!-- 课程板块遍历 -->
	{if !empty($list)} {loop $list $rec}
	<div class="course_wrap mt10">
	
	
	 <div class="vg-bg-default vg-padding-top-xs">
        <div class="vg-bg-white vg-padding-horizontal-sm vg-padding-top vg-padding-bottom-sm">
            <div class="vg-text-default vg-text-bold vg-tit-bdl-2 vg-padding-left-xs vg-lh-1">精品课程</div>
        </div>
	</div>
	
	
	<link href="{MODULE_URL}template/mobile/style/cssv2/search.css?v={$versions}" rel="stylesheet" />
	<!-- 筛选条件 -->
	<div id="nav" class="nav">
		<div id="sort-list" class="dropdown">
			<div class="dropdown_description">
				综合排序 <i class="fa fa-angle-down"></i>
				<div id="contact_ico" class="contact_ico"><i class="fa fa-angle-up"></i></div>
			</div>
		</div>
		<div class="dropdown" onclick="location.href='{php echo $this->createMobileUrl('search', array('op'=>'allcategory'));}'">
			<div class="dropdown_description">全部分类<i class="fa fa-angle-down" id="nav_ico"></i></div>
		</div>
	</div>
	<div class="dropdown_wrapper" id="dropdown_wrapper" style="    position: relative;top:0;">
		<ul class="dropdown_menu">
			<li class="dropdown_item {if empty($sort)}z-open{/if}" onclick="goSearch('')">综合排序</li>
			<li class="dropdown_item {if $sort=='free'}z-open{/if}" onclick="goSearch('free')">免费课程</li>
			<li class="dropdown_item {if $sort=='price'}z-open{/if}" onclick="goSearch('price')">价格优先</li>
			<li class="dropdown_item {if $sort=='hot'}z-open{/if}" onclick="goSearch('hot')">人气优先</li>
			<li class="dropdown_item {if $sort=='score'}z-open{/if}" onclick="goSearch('score')">好评优先</li>
		</ul>
	</div>
	<input type="hidden" id="sort" value="0"/>
	<!-- /筛选条件 -->
	<!-- 遮罩层 -->
<div id="sort_background" class="dropdown__background"></div>
<!-- /遮罩层 -->
<div id="loading" style="position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.6);z-index:999999999;"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div></div>

<script type="text/javascript">
var nav = document.getElementById("nav");
var dropdown_wrapper = document.getElementById("dropdown_wrapper");
var contact_ico = document.getElementById("contact_ico");
var sort_background = document.getElementById("sort_background");

$("#sort-list").on("click", function(){
	var sort = $("#sort").val();
	if(sort==0){
		$("#sort").val(1);
		dropdown_wrapper.style.display = "block";
		contact_ico.style.display = "block";
		nav.style.borderBottomColor = "#23b8ff";
		sort_background.style.display = "block";
	}else{
		$("#sort").val(0);
		dropdown_wrapper.style.display = "none";
		contact_ico.style.display = "none";
		nav.style.borderBottomColor = "#e2e2e2";
		sort_background.style.display = "none";
	}
});
$("#sort_background").on("click", function(){
	$("#sort").val(0);
	dropdown_wrapper.style.display = "none";
	contact_ico.style.display = "none";
	nav.style.borderBottomColor = "#e2e2e2";
	sort_background.style.display = "none";
});

function goSearch(sort){
	var siteUrl = "{php echo $this->createMobileUrl('search');}";
	if(sort=='free'){
		siteUrl = siteUrl + "&sort=free";
	}else if(sort=='price'){
		siteUrl = siteUrl + "&sort=price";
	}else if(sort=='hot'){
		siteUrl = siteUrl + "&sort=hot";
	}else if(sort=='score'){
		siteUrl = siteUrl + "&sort=score";
	}else{
		siteUrl = siteUrl + "&sort=";
	}
	
	getData(1,siteUrl);
	$("#sort-list").click();
}



var search = function() {
    var keywords = $.trim($("#searchInput").val());
    if (keywords == '') {
        searchUrl = '{php echo $this->createMobileUrl("search");}';
    } else {
        searchUrl = '{php echo $this->createMobileUrl("search");}&keyword=' + encodeURIComponent(keywords);
    }
    document.location.href = searchUrl;
    return false;
};
$("#searchInput").keydown(function(event) {
	if (event.keyCode == 13) {
		search();
	}
});
$("#search_btn").on("click", function(){
	search();
});
</script>
<script type="text/javascript">
var ajaxUrl   = "{php echo $_W['siteUrl'];}";
var attachUrl = "{php echo $_W['attachurl'];}";
var lessonUrl = "{php echo $this->createMobileUrl('lesson');}";

	var i = 1; //设置当前页数，全局变量
    function getData(page,siteUrl) {
		i++;
        $.get(siteUrl, {page: page}, function (data) {  
            if (data.length > 0) {
            	loading.style.display = 'none';
                var jsonObj = JSON.parse(data);
                insertDiv(jsonObj);
				
            }
        });  
    } 
    //初始化加载第一页数据  
    getData(1);

    //生成数据html,append到div中  
    function insertDiv(result) {  
        var mainDiv =$("#js-course-list");
        var chtml = '';  
        for (var j = 0; j < result.length; j++) {
            chtml += '<li class="vg-padding-horizontal-xs vg-padding-vertical-sm vg-bdb-default">';
            chtml += '	<a class="row vg-block" href="' + lessonUrl + '&id=' + result[j].id + '">';
            chtml += '	<div class="small-3 columns vg-padding-horizontal-0">';
            chtml += '	<div class="list-img-wrap vg-parent-box">';
            chtml += '		 <img class="pro-img-limit" width="100%" src="' + attachUrl + result[j].images + '">';
            chtml += '		  <span class="vg-text-xxs vg-top-right1 vg-text-smgray teacher vg-padding-horizontal-xs vg-bg-black-50 text-right">VIP免费</span>';
            chtml += '			 <div class="protype-icon"><i class="icon iconfont  vg-text-sm vg-text-white"> &#xe728;</i></div>';
            chtml += '			 </div>    </div>     <div class="small-9 columns vg-padding-right-0 info">';
            chtml += '			 <h4 class="vg-text-sm vg-text-black vg-margin-bottom-0">' + result[j].bookname + '</h4>';
            chtml += '			 <div class="vg-clearfloat">';
            chtml += '			 <div class="vg-fl vg-w50 vg-text-sm vg-text-smblack teacher">' + timestampToTime(result[j].update_time) + '</div>';
            chtml += '			 <div class="vg-fr vg-w50 vg-text-xs text-right  vg-text-smblack code">讲师:' + result[j].teacher + ' <span></span></div> </div>';
            chtml += '				<div class="vg-clearfloat"><div class="vg-fl vg-w50 vg-text-xs vg-text-smblack teacher">';
            chtml += '				<i class="blue-color">' + result[j].buyTotal + '</i>人已学习</div>';
			
            chtml += '				<div class="vg-fr vg-w50 vg-text-xs text-right vg-main-font-color teacher"> ' + result[j].price + '</div>';
			 
            chtml += '			</div> </div>    </a>     </li>';
           
        }
		mainDiv.html(chtml);
		$("#loading_div").empty();
		if(result.length==0){
			document.getElementById("loading_div").innerHTML='<div class="loading_bd">没有了，已经到底了</div>';
		}
    }

	function timestampToTime(timestamp) {
        var date = new Date(timestamp * 1000);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
        Y = date.getFullYear() + '-';
        M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
        D = date.getDate() + ' ';
		 h = date.getHours() + ':';
        m = date.getMinutes() ;
       
        return Y+M+D+h+m;
    }
	
  
    //==============核心代码=============  
    var winH = $(window).height(); //页面可视区域高度   
  
    var scrollHandler = function () {  
        var pageH = $(document.body).height();  
        var scrollT = $(window).scrollTop(); //滚动条top   
        var aa = (pageH - winH - scrollT) / winH;  
        if (aa < 0.02) { 
            if (i % 1 === 0) {
                getData(i);  
                $(window).unbind('scroll');  
                $("#btn_Page").show();
            } else {  
                getData(i);  
                $("#btn_Page").hide();
            }  
        }  
    }  
    //定义鼠标滚动事件
    $(window).scroll(scrollHandler);
    //继续加载按钮事件
    $("#btn_Page").click(function () {
    	loading.style.display = 'block';
        getData(i);
        $(window).scroll(scrollHandler);
    });
  

</script>
	
	 <ul class="list vg-padding-top-sm vg-padding-horizontal-xs" id="js-course-list">
		{loop $rec['lesson'] $item}
		<?php //print_r($item); ?>
                    <li class="vg-padding-horizontal-xs vg-padding-vertical-sm vg-bdb-default">
                        <a class="row vg-block" href="{php echo $this->createMobileUrl('lesson', array('op'=>'display', 'id'=>$item['id']));}">
                            <div class="small-3 columns vg-padding-horizontal-0">
                                <div class="list-img-wrap vg-parent-box">
                                    <img class="pro-img-limit" width="100%" src="{$_W['attachurl']}{$item['images']}">
                                   {if !empty($item['ico_name'])} <span class="vg-text-xxs vg-top-right1 vg-text-smgray teacher vg-padding-horizontal-xs vg-bg-black-50 text-right">VIP免费</span>{/if}
                                    <div class="protype-icon"><i class="icon iconfont  vg-text-sm vg-text-white"> &#xe728;</i></div>
                                </div>    </div>     <div class="small-9 columns vg-padding-right-0 info">
                                <h4 class="vg-text-sm vg-text-black vg-margin-bottom-0">{$item['bookname']}</h4>
                                <div class="vg-clearfloat">
                                    <div class="vg-fl vg-w50 vg-text-sm vg-text-smblack teacher">{php echo date('Y-m-d H:i',$item['update_time']);}</div>
                                    <div class="vg-fr vg-w50 vg-text-xs text-right  vg-text-smblack code">讲师:{$item['teacher']} <span></span></div> </div>
                                <div class="vg-clearfloat">
                                    <div class="vg-fl vg-w50 vg-text-xs vg-text-smblack teacher">
                                        <i class="blue-color">{if $item['price']>0}{php echo $item['buynum']+$item['virtual_buynum'];}{else}{php echo $item['buynum']+$item['virtual_buynum']+$item['visit_number'];}{/if}</i>人已学习</div>
                                    <div class="vg-fr vg-w50 vg-text-xs text-right vg-main-font-color teacher">
                                        {php echo $item['price']>0?'¥'.$item['price']:'免费';}</div>
                                </div> </div>    </a>     </li>
                                    
         {/loop}              
                            </ul>
	
	 <div id="loading_div"></div>
	
	
	
	
	
	
	
		<!--<h2 class="course_hd"><span class="bor-l"></span>{$rec['rec_name']}</h2>
		{if $rec['show_style']==1}
		<ul class="course_main course_other">
			{loop $rec['lesson'] $item}
			<li class="course_item">
				<a href="{php echo $this->createMobileUrl('lesson', array('op'=>'display', 'id'=>$item['id']));}">
					<div class="course_pic">
						{if !empty($item['ico_name'])}
						<span class="course_ico courseNew" style="background:url('../addons/fy_lessonv2/template/mobile/images/{$item['ico_name']}.png') no-repeat;background-size: 40px 40px;"></span>
						{/if}
						<img class="lazy" src="{$_W['attachurl']}{$item['images']}" alt="{$item['bookname']}" />
						<p class="course_living">{$item['bookname']}</p>
					</div>
					<p>
						<span class="fl red-color">{php echo $item['price']>0?'¥'.$item['price']:'免费';}</span>
						<span class="fr">已更新<i class="blue-color">{$item['count']}</i>节课</span>
					</p>
					<p>
						{if $setting['stock_config']==1}
						<span class="fl">仅剩:{$item['stock']}</span> {/if}
						<span class="fr"><i class="blue-color">{if $item['price']>0}{php echo $item['buynum']+$item['virtual_buynum'];}{else}{php echo $item['buynum']+$item['virtual_buynum']+$item['visit_number'];}{/if}</i>人已学习</span>
					</p>
				</a>
			</li>
			{/loop}
		</ul>
		{elseif $rec['show_style']==2}
		<ul class="course_main course_live">
			<li class="course_item" style="width:100%;">
				<a href="{php echo $this->createMobileUrl('lesson', array('op'=>'display', 'id'=>$rec['lesson'][0]['id']));}">
					<div class="course_pic">
						{if !empty($rec['lesson'][0]['ico_name'])}
						<span class="course_ico courseNew" style="background:url('../addons/fy_lessonv2/template/mobile/images/{$rec['lesson'][0]['ico_name']}.png') no-repeat;background-size: 40px 40px;"></span>
						{/if}
						<img class="lazy" src="{$_W['attachurl']}{$rec['lesson'][0]['images']}" alt="{$rec['lesson'][0]['bookname']}" style="height:184px" />
					</div>
					<h3>{$rec['lesson'][0]['bookname']}</h3>
					<p>
						<span class="fl red-color" style="font-size:13px;">{php echo $rec['lesson'][0]['price']>0?'¥'.$rec['lesson'][0]['price']:'免费';}</span>
						<span class="fr">已有<i class="blue-color">{if $rec['lesson'][0]['price']>0}{php echo $rec['lesson'][0]['buynum']+$rec['lesson'][0]['virtual_buynum'];}{else}{php echo $rec['lesson'][0]['buynum']+$rec['lesson'][0]['virtual_buynum']+$rec['lesson'][0]['visit_number'];}{/if}</i>人学习</span>
					</p>
				</a>
			</li>
			{loop $rec['lesson'] $key $item} {if $key>0}
			<li class="course_item">
				<a href="{php echo $this->createMobileUrl('lesson', array('op'=>'display', 'id'=>$item['id']));}">
					<div class="course_pic">
						{if !empty($item['ico_name'])}
						<span class="course_ico courseNew" style="background:url('../addons/fy_lessonv2/template/mobile/images/{$item['ico_name']}.png') no-repeat;background-size: 40px 40px;"></span>
						{/if}
						<img class="lazy" src="{$_W['attachurl']}{$item['images']}" alt="{$item['bookname']}" />
						<p class="course_living">{$item['bookname']}</p>
					</div>
					<p>
						<span class="fl red-color">{php echo $item['price']>0?'¥'.$item['price']:'免费';}</span>
						<span class="fr">已更新<i class="blue-color">{$item['count']}</i>节课</span>
					</p>
					<p>
						{if $setting['stock_config']==1}
						<span class="fl">仅剩:{$item['stock']}</span> {/if}
						<span class="fr"><i class="blue-color">{if $item['price']>0}{php echo $item['buynum']+$item['virtual_buynum'];}{else}{php echo $item['buynum']+$item['virtual_buynum']+$item['visit_number'];}{/if}</i>人已学习</span>
					</p>
				</a>
			</li>
			{/if} {/loop}
		</ul>
		{elseif $rec['show_style']==3}
		<ul class="course_main course_live">
			{loop $rec['lesson'] $item}
			<li class="course_item" style="width:100%;">
				<a href="{php echo $this->createMobileUrl('lesson', array('op'=>'display', 'id'=>$item['id']));}">
					<div class="course_pic">
						{if !empty($item['ico_name'])}
						<span class="course_ico courseNew" style="background:url('../addons/fy_lessonv2/template/mobile/images/{$item['ico_name']}.png') no-repeat;background-size: 40px 40px;"></span>
						{/if}
						<img class="lazy" src="{$_W['attachurl']}{$item['images']}" alt="{$item['bookname']}" style="height:184px" />
						<p class="course_living">{$item['bookname']}</p>
					</div>
				</a>
			</li>
			{/loop}
		</ul>
		{/if}
	</div>
	{/loop} {/if}-->
	<!-- /课程板块遍历 -->
	
	{if !empty($config['index_slogan'])}
	<div class="slogan_wrap">
		<div class="slogan_bd" style="background-image:url({$_W['attachurl']}{$config['index_slogan']});"></div>
	</div>
	{/if}
</div>

<!-- 绑定手机号码 -->
{if $setting['modify_mobile']==2 && $uid>0 && empty($member['mobile'])}
<div style="background-color:rgba(0,0,0,0.7); position:fixed; width:100%; height:100%; top:0; z-index:100000000;"></div>
<div class="login_wrap" id="modify_mobile_div" style="position:absolute; width:90%; height:100%; margin:0 5%; top:80px; z-index:100000001;">
	<form method="post" onsubmit="return checknum();">
		<div class="weui_cells weui_cells_form" style="border-radius:10px; padding-bottom:20px;">
			<h3 style="padding:15px 0; text-align:center; font-size:18px;">请绑定手机号码</h3>
			<div class="weui_cell">
				<div class="weui_cell_hd"><label class="weui_label" for="registerform-mobile">手机号码</label></div>
				<div class="weui_cell_bd weui_cell_primary">
					<input type="tel" class="weui_input" name="mobile" placeholder="请输入手机号码">
				</div>
			</div>
			<div class="weui_cell check_code">
				<div class="weui_cell_hd">
					<label class="weui_label">验证码</label>
				</div>
				<div class="weui_cell_bd weui_cell_primary">
					<input type="tel" class="weui_input" name="verify_code" placeholder="请输入验证码">
				</div>
				<div class="weui_cell_ft">
					<a href="javascript:;" id="weui_btn_send" onclick="sendcode()">获取验证码</a>
				</div>
			</div>
			{if in_array('password', $index_verify)}
			<div class="weui_cell">
				<div class="weui_cell_hd"><label class="weui_label" for="registerform-mobile">登录密码</label></div>
				<div class="weui_cell_bd weui_cell_primary">
					<input type="password" class="weui_input" name="pwd1" placeholder="设置登录密码">
				</div>
			</div>
			<div class="weui_cell">
				<div class="weui_cell_hd"><label class="weui_label" for="registerform-mobile">重复密码</label></div>
				<div class="weui_cell_bd weui_cell_primary">
					<input type="password" class="weui_input" name="pwd2" placeholder="重复登录密码">
				</div>
			</div>
			{/if}
			<div class="weui_btn_area">
				<input type="hidden" name="token" value="{$_W['token']}" />
				<input type="submit" name="modify_mobile" class="weui_btn weui_btn_primary" value="提交">
			</div>
		</div>
	</form>
</div>
<script type="text/javascript">
document.getElementById("modify_mobile_div").style.height = document.getElementById("weui_tab_div").offsetHeight + "px";

function checknum(){
	var mobile   = $("input[name=mobile]").val();
	var myreg = /^((13|14|15|17|18|19)+\d{9})$/;
	if(mobile==''){
		alert("请输入手机号码");
		return false;
	}else if(!myreg.test(mobile)) {
		alert('您输入的手机号码有误');
		return false;
	}

	<?php if(in_array('password', $index_verify)){ ?>
	if($("input[name=verify_code]").val()==''){
		alert("请输入短信验证码");
		return false;
	}
	if($("input[name=pwd1]").val()==''){
		alert("请输入登录密码");
		return false;
	}
	if($("input[name=pwd1]").val() != $("input[name=pwd2]").val()){
		alert("两次密码不一致");
		return false;
	}
	<?php } ?>

	document.getElementById("spinners").style.display = 'block';
}

var countdown = 60;
function sendcode() {
	var result = checkMobile();
	if(!result){
		return;
	}
	if ($('#weui_btn_send').hasClass('has_send')) {
		return false;
	}

	var mobile = $('input[name="mobile"]').val();
	$.ajax({
		type:"post",
		dataType:"json",
		url: "{php echo $this->createMobileUrl('sendcode');}",
		data: {mobile:mobile},
		success: function (data) {
			if(data.code==0){
				settime($("#weui_btn_send"));
			}else{
				alert(data.msg);
			}
		},
		error: function(e){
		}
	});
	
}
function settime(obj) { //发送验证码倒计时
	if(countdown == 0) {
		$('#weui_btn_send').removeClass('has_send').text('重新发送');
		countdown = 60;
		return;
	} else {
		$('#weui_btn_send').addClass('has_send').text('重新获取(' + countdown + ')');
		countdown--;
	}
	setTimeout(function() {
		settime(obj)
	}, 1000)
}
//校验手机号是否合法
function checkMobile() {
	var mobile = $('input[name="mobile"]').val();
	var myreg = /^((13|14|15|16|17|18|19)+\d{9})$/;
	if(!myreg.test(mobile)) {
		alert('请输入有效的手机号码');
		return false;
	} else {
		return true;
	}
}
</script>
{/if}
<!-- /绑定手机号码 -->

<footer>
    <a href="{php echo $this->createMobileUrl('index');}">{$setting['copyright']}</a>
</footer>

<div id="spinners" style="display:none;"><div class="spinner"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div></div>

{php echo register_jssdk(false);}
<script type="text/javascript">
wx.ready(function(){
	var shareData = {
		title: "{$sharelink['title']} - {$setting['sitename']}",
		desc: "{$sharelink['desc']}",
		link: "{php echo $shareurl;}",
		imgUrl: "{php echo $_W['attachurl'];}{$sharelink['images']}",
		trigger: function (res) {},
		complete: function (res) {},
		success: function (res) {},
		cancel: function (res) {},
		fail: function (res) {}
	};
	wx.onMenuShareTimeline(shareData);
	wx.onMenuShareAppMessage(shareData);
	wx.onMenuShareQQ(shareData);
	wx.onMenuShareWeibo(shareData);
	wx.onMenuShareQZone(shareData);
});

var search = function() {
    var keywords = $.trim($("#searchInput").val());
    if (keywords == '') {
        searchUrl = '{php echo $this->createMobileUrl("search");}';
    } else {
        searchUrl = '{php echo $this->createMobileUrl("search");}&keyword=' + encodeURIComponent(keywords);
    }
    document.location.href = searchUrl;
    return false;
};
$("#searchInput").keydown(function(event) {
	if (event.keyCode == 13) {
		search();
	}
});
$("#search_btn").on("click", function(){
	search();
});
</script>
 <script type="text/javascript">
      $.ajaxSetup({
          headers: {
              'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
          }
      });
      $('#subscriptionAccountsShow').on('touchend', function (event) {
          $('.weChat-body-shadow').slideDown();
          return false;
      });
      $('.weChat-shadow-close').on('touchstart', function () {
          $('.weChat-body-shadow').slideUp();
          return false;
      });
    function urlarray(url) {
        if (!url) {
            url = location.search.substring(1);
        } else {
            url = url.substr(url.lastIndexOf('?') + 1);
        }
        var args = new Object();   // 声明并初始化一个 "类"
        // 获得地址(URL)"?"后面的字符串.
        var query = decodeURI(url);
        var pairs = query.split("&");  // 分割URL(别忘了'&'是用来连接下一个参数)
        for (var i = 0; i < pairs.length; i++) {
            var pos = pairs[i].indexOf('=');
            if (pos == -1) continue; // 它在找有等号的 数组[i]
            var argname = pairs[i].substring(0, pos); // 参数名字
            var value = pairs[i].substring(pos + 1);  // 参数值
            // 以键值对的形式存放到"args"对象中
            args[argname] = decodeURI(value);
        }
        return args;
    }
      </script>
      <script>
        if ($('.bd ul li').length > 0) {
            TouchSlide({
                slideCell: "#slideBox",
                titCell: ".hd ul",
                mainCell: ".bd ul",
                effect: "leftLoop",
                interTime: 4500,
                autoPage: true,
                autoPlay: true
            });
            $('.bd li').removeClass('hide');
        }

        
                $('.bd ul').removeClass('hide');
        $(function () {
            var startX, startY, endX, endY, startX1, startY1, endX1, endY1;
            $('#gzhShow').on('touchstart', function (event) {
                var touches = event.originalEvent.targetTouches[0];
                startX = touches.clientX;
                startY = touches.clientY;
            });
            $('#bzrShow').on('touchstart', function (event) {
                var touches1 = event.originalEvent.targetTouches[0];
                startX1 = touches1.clientX;
                startY1 = touches1.clientY;
            });
            $('#gzhShow').on('touchend', function (event) {
                var that = this;
                var touches = event.originalEvent.changedTouches[0];
                endX = touches.clientX;
                endY = touches.clientY;
                if (Math.abs(startX - endX) < 6 && Math.abs(startY - endY) < 6) {
                    $(this).next('.body-shadow').slideDown();
                    return false;
                }
                ;
            });
            $('#bzrShow').on('touchend', function (event) {
                var that = this;
                var touches1 = event.originalEvent.changedTouches[0];
                endX1 = touches1.clientX;
                endY1 = touches1.clientY;
                if (Math.abs(startX1 - endX1) < 6 && Math.abs(startY1 - endY1) < 6) {
                    $(this).next('.body-shadow').slideDown();
                    return false;
                }
                ;
            });

            $('.shadow-close').on('touchstart', function () {
                $(this).parents('.body-shadow').slideUp();
                return false;
            });


            $(".vg-mb3-select").click(function () {
                var id = $(this).attr('data-cat');
                var url = "http://mobile5.51ckjr.com/getOnlineByCat/" + id;
                $.get(url, function (response) {
                    $(".list").html(response.data);
//                    $("img.lazy2").lazyload({effect: "fadeIn"});
                    if (response.next) {
                        $('.more-data').show()
                        $('.more-data').attr("data-page", response.next);
                    } else {
                        $('.more-data').hide()
                    }
                });
                $('#tabControl>div i').removeClass('rotate180');
                $(this).parent().slideUp();
                return false;
            });
            <!-- tab菜单 -->
            var tabFun = function () {
                var flag = 0;
                var num = 0;
                $('#tabControl>div').on('touchstart', function () {

                    if ($(this).index() == num) {
                        if (flag == 0) {
                            $('i', this).addClass('rotate180');
                            $('#tabWrap>div').eq(num).slideDown();
                            flag = !flag;
                        } else {
                            $('i', this).removeClass('rotate180');
                            $('#tabWrap>div').eq(num).slideUp();
                            flag = !flag;
                        }
                        ;
                    } else {
                        num = $(this).index();
                        $('#tabControl>div i').removeClass('rotate180');
                        $('i', this).addClass('rotate180');
                        $('#tabWrap>div').slideUp();
                        $('#tabWrap>div').eq(num).slideDown();
                    }
                });
            }
            tabFun();
                                <!-- 签到代码，还需要判断是否已签到 -->
                            ;
            $('#signBtn').on('click', function () {
                $("#signBtn").attr("disabled", true);
                $.post('/signin', {v1: 1}, function (data) {
                    $("#signBtn").attr("disabled", false);
                    var that = this;
                    if (data.status == "success") {
                        $('#signmsg').html('已签到');
                        $('#signBtn span').slideDown();
                        setTimeout(function () {
                            $('#signBtn').hide();
                        }, 3000);
                    } else {
                        alert(data.msg);
                    }
                }, "json");
            })
                        <!-- 视频列表加载 -->
                            $('.more-data').click(function () {
                var url = $(this).attr('data-page');
                $(this).html('正在加载...');
                $.get(url, function (response) {
                    if (response.data) {
                        $(".list").append(response.data);
                        if (response.next) {
                            $('.more-data').attr('data-page', response.next);
                            $('.more-data').html('点击查看更多');
                        } else {
                            $('.more-data').hide();
                        }
                    }
                })
            })
                    });
        <!-- 消息提示框自动消失 -->
        function codefans() {
            var box = document.getElementById("isNotice");
            if (box) {
                box.style.display = "none";
            }
        }
        setTimeout("codefans()", 6000);
    </script>
{template '_footerv2'}